﻿using Microsoft.AspNetCore.SignalR;

using System.Threading.Tasks;

namespace NoodleShop.Api.Messaging
{
    public class SignalrSender : IMessageSender
    {
        private readonly IHubContext<NotificationHub> _ordersHubContext;

        public SignalrSender(IHubContext<NotificationHub> ordersHubContext)
        {
            _ordersHubContext = ordersHubContext;
        }

        public async Task Send(string message, params string[] args)
        {
            await _ordersHubContext.Clients.All.SendAsync(message, args[0], args[1]);
        }
    }
}
